package com.power.flowable.api;

import com.plf.common.domain.ResponseDTO;
import com.power.flowable.model.Act_dsn_form_define;
import com.power.flowable.model.pageinfo.Act_dsn_form_definePageInfo;
import com.power.flowable.model.pageinfo.ProcessDefinitionPageInfo;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;



@FeignClient(value = "sfflow-svr", contextId = "sfflow-svr", path = "/sfflow-svr")
@RestController
public interface IAct_dsn_form_defineFeign {

    /**
     * 流程表单定义分页列表
     */
    @PostMapping("/act_dsn_form_define/list")
    ResponseDTO list(@RequestBody Act_dsn_form_definePageInfo act_dsn_form_definePageInfo);

    /**
	 * 查询未配置表单的流程列表
	 * @return
	 */
    @PostMapping("/act_dsn_form_define/findOptionalProcessList")
    ResponseDTO findOptionalProcessList(@RequestBody ProcessDefinitionPageInfo pageinfo);

    /**
     * 查看流程表单定义
     */
    @PostMapping("/act_dsn_form_define/view")
    ResponseDTO view(@RequestParam String formid);

    /**
     * 通过key查询最大版本的流程表单定义
     * @param modelKey 流程模型key
     * @return
     */
    @PostMapping("/act_dsn_form_define/getMaxDefineByKey")
    ResponseDTO getMaxDefineByKey(@RequestParam String modelKey);

    /**
     * 修改或保存流程表单定义
     */
    @PostMapping("/act_dsn_form_define/save")
    ResponseDTO save(@RequestBody Act_dsn_form_define  act_dsn_form_define, @RequestParam(value = "editDataSource",defaultValue = "false")boolean editDataSource);

    /**
     * 删除流程表单定义
     */
    @PostMapping("/act_dsn_form_define/delete/{id}")
    ResponseDTO delete(@PathVariable Integer id);

    /**
     * 批量删除流程表单定义
     */
    @PostMapping("/act_dsn_form_define/batchDel")
    ResponseDTO batchDel(@RequestParam String ids);

    /**
     * 查询出现次数最多的类型，取前十个
     */
    @PostMapping("/act_dsn_form_define/queryCategory")
    ResponseDTO queryCategory();

    /**
     * 流程表单编辑校验
     * @param formid
     * @return
     */
    @PostMapping("/act_dsn_form_define/editCheck")
    ResponseDTO editCheck(@RequestParam String formid);

    /**
     * 流程表单定义发布
     * @param formid 表单id
     * @param modelKey 模型key
     * @param tenantid 租户id
     * @return
     */
    @PostMapping("/act_dsn_form_define/publish")
    ResponseDTO publish(@RequestParam String formid, @RequestParam String modelKey, @RequestParam(required = false) String tenantid);

    /**
     * 根据formid获取流程, 发布时保存的流程模型预览图
     * @param formid
     * @return
     */
    @PostMapping(value = "act_dsn_form_define/getDiagramByFormid")
    Response getDiagramByFormid(@RequestParam String formid);


    /**
     * 启用/停用流程表单
     */
    @PostMapping("/act_dsn_form_define/enable")
    ResponseDTO enable(@RequestParam String id, @RequestParam Integer enable);

    /**
     * 统计表单定义当前的 1. 最高版本, 2. 正在运行的流程实例数, 3. 已完成的流程实例数,
     * @param modelKey
     * @return Map<maxVersion: 最高版本, currently: 正在运行的流程实例数,  complete:  已完成的流程实例数>
     */
    @PostMapping("/act_dsn_form_define/formStatistics")
    ResponseDTO formStatistics(@RequestParam String modelKey);

    /**
     * 数据源被流程引用的次数
     */
    @PostMapping("/act_dsn_form_define/useNum")
    ResponseDTO useNum(@RequestParam String id);

    /**
     * 保存办结时限配置
     * @param act_dsn_form_define
     * @return
     */
    @PostMapping("/act_dsn_form_define/limitSave")
    ResponseDTO limitSave(@RequestBody Act_dsn_form_define act_dsn_form_define);

    /**
     * 仅更新流程表单, 不发布流程
     * @param formid 0号版本formid
     * @return
     */
    @PostMapping("/act_dsn_form_define/updateMaxFormDefine")
    ResponseDTO updateMaxFormDefine(@RequestParam String formid);

}
